import React, { useState ,useRef } from 'react';

function Ref(){
    const input = useRef(1)
    const button = useRef(1)
    console.log(1,input)
    const onButtonClick=()=>{ 
        console.log(2,input) 
        input.current.value="Hello ,JSPang"
        console.log(3,input,button)//输出获取到的DOM节点
    }
    return(
        <>
            <input type="text" ref={input} />
            <button onClick = {onButtonClick} ref={button}>点击</button>
        </>
    )
}

export default Ref;